package ninja.awesome.game.main;

import java.util.LinkedList;

import ninja.awesome.game.classes.Friendly;
import ninja.awesome.game.classes.Hostile;
import ninja.awesome.game.classes.Neutral;
import ninja.awesome.game.compat.Rectangle;
import ninja.awesome.game.gameobject.Building;
import ninja.awesome.game.gameobject.Bush;
import ninja.awesome.game.gameobject.Tree;

public class Physics {

	public static boolean collision(Friendly f, Hostile h) {
		if (Rectangle.intersects(f.getBounds(), h.getBounds())) {
			return true;
		}
		return false;
	}

	public static boolean collision(Hostile h, Friendly f) {
		if (Rectangle.intersects(h.getBounds(), f.getBounds())) {
			return true;
		}
		return false;
	}

	public static boolean collision(Neutral n, Friendly f) {
		if (Rectangle.intersects(n.getBounds(), f.getBounds())) {
			return true;
		}
		return false;
	}

	public static boolean collision(Building bldg, Friendly f) {
		if (Rectangle.intersects(bldg.getBounds(),f.getBounds())) {
			return true;
		}
		return false;
	}

	public static boolean collision(Hostile h, LinkedList<Friendly> fl) {
		for (int i = 0; i < fl.size(); i++) {
			if (Rectangle.intersects(h.getBounds(),fl.get(i).getBounds())) {
				return true;
			}
		}
		return false;
	}

	public static boolean collision(Bush bush, Building building) {
		if (Rectangle.intersects(bush.getBounds(),building.getBounds())) {
			return true;
		}
		return false;
	}

	public static boolean collision(Tree tree, Building building) {
		if (Rectangle.intersects(tree.getBounds(), building.getBounds())) {
			return true;
		}

		return false;
	}

}
